<template>
	<view style="height: 100%">
		<!-- pages/orderSubmit/orderSubmit.wxml -->

		<view class="express">
			<view class="order-info algin">
				订单金额:
				<text class="Fmoney">￥{{ Ftotal }}</text>
			</view>
			<view v-if="Fstatus == 1" class="algin order-result">
				<i style="font-size: 22px" class="kxfont icon-xuanzhong"></i>
				<text>提交成功</text>
			</view>
		</view>
		<view class="express">
			<view class="v-center">
				<i class="kxfont icon-tishishuoming"></i>
				<text class="ordercode">请到个人中心-订单中心查询</text>
			</view>
		</view>
		<view class="express">
			<view class="v-center">
				<view class="v-center">
					<i class="kxfont icon-wxbdingwei"></i>
				</view>
				<view class="address">
					<view class="addname">
						{{ addressInfo.Fprovince }}{{ addressInfo.Fcity }}{{ addressInfo.Fzone }}{{ addressInfo.Faddress }}
					</view>
					<view class="adduname">{{ addressInfo.Fcontacter }} {{ addressInfo.Fmobile }}</view>
				</view>
			</view>
		</view>
		<!-- 抽奖 -->
		<view class="bottomBar algin">
			<navigator class="left-half algin" hover-class="none" url="/pages/index/index" open-type="switchTab">返回首页
			</navigator>
			<view @tap="goOrder" class="right-half algin" :style="'background:' + color">查看订单</view>
		</view>
	</view>
</template>

<script>
	// pages/payresult/payResult.js
	var util = require('../../utils/util.js');
	var api = require('../../utils/prom.js');
	const app = getApp();
	export default {
		data() {
			return {
				color: app.globalData.color,
				Fcj: 0,
				addressInfo: {
					Fprovince: '',
					Fcity: '',
					Fzone: '',
					Faddress: '',
					Fcontacter: '',
					Fmobile: ''
				},
				Ftotal: 0,
				Fstatus: 0,
				source: 1,
				Isdefault: false,
				Fcode: ''
			};
		}
		/**
		 * 生命周期函数--监听页面加载
		 */
		,
		onLoad: function(options) {
			var Ftotal = options.Ftotal;
			var Fstatus = options.Fstatus;
			var Fcode = options.Fcode;
			var source = options.source;
			var addressInfo = {};
			if (!util.isEmpty(options.FaddressInfo)) {
				addressInfo = JSON.parse(unescape(options.FaddressInfo));
			}
			var that = this;

			that.Ftotal = Ftotal;
			that.Fstatus = Fstatus;
			that.Fcode = Fcode;
			that.source = source;
			that.addressInfo = addressInfo;

			that.relogin();
		},
		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function() {},
		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {},
		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide: function() {},
		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload: function() {},
		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function() {},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {}, 
		methods: {
			relogin: function() {
				var param = {
					token: uni.getStorageSync('token')
				};
				api.request('SpReLogin', 'get', param, function(res) {
					uni.setStorageSync('user', res.data.User);
				});
			},

			switchChange: function(e) {
				console.log('switch 发生 change 事件，携带值为', e.detail.value);
				var that = this;
				that.Isdefault  = e.detail.value;
			},

			goMain: function() {
				var url = '/pages/index/index';
				uni.navigateTo({
					url: url
				});
			},

			goOrder: function() {
				var url = '/pages/orderDetail/orderDetail?code=' + this.Fcode;
				uni.redirectTo({
					url: url
				});
			}
		}
	};
</script>
<style>
	@import './payResult.css';
</style>